# -*- encoding: utf-8 -*-

from datascrapy.util import redisutil
from datascrapy.settings import COOKIE_KEY


def set_response_cookie(response):
    cookie_str = str(response.headers["Set-Cookie"])
    redisutil.set_value(COOKIE_KEY, cookie_str.split(";", 1)[0])


def get_response_cookie():
    return redisutil.get_value(COOKIE_KEY)
